// Formatted using ``gofmt -w=true -spaces=true -tabwidth=4 -tabindent=false``
package main

import (
    "flag"
    "fmt"
    "strings"
)

func main() { // Not exported since starts with a lowercase letter
    flag.Parse()

    // var s String = ...
    // var s = ..
    s := "Hello, " // := is "declare variable and assign"; init declaration

    /* Originally if/else statement. Had to look up in the language spec how to
       write an 'else' clause. */
    // Trailing semi-colon causes switch to have cases match on 'true'.
    switch argCount := flag.NArg(); {
    case argCount == 0:
        s += "World"
    case argCount == 1:
        s += flag.Arg(0)
    default:
        {
            /*for x := range flag.Args()[:argCount-1] {
                s += flag.Arg(x) + ", "
            }*/
            s += strings.Join(flag.Args()[:argCount-1], ", ")
            s += ", and " + flag.Arg(argCount-1)
        }
    }

    s += "!"

    fmt.Println(s)
}
